<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude
           , BangPatterns
           , NondecreasingIndentation
           , MagicHash
  #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# OPTIONS_GHC  -funbox-strict-fields #-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Module      :  GHC.IO.Encoding.UTF16</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow, 2009</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Portability :  non-portable</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- UTF-16 Codecs for the IO library</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- Portions Copyright   : (c) Tom Harper 2008-2009,</span><span>
</span><span id="line-22"></span><span class="hs-comment">--                        (c) Bryan O'Sullivan 2009,</span><span>
</span><span id="line-23"></span><span class="hs-comment">--                        (c) Duncan Coutts 2009</span><span>
</span><span id="line-24"></span><span class="hs-comment">--</span><span>
</span><span id="line-25"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.IO.Encoding.UTF16</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-28"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16"><span class="hs-identifier">utf16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16"><span class="hs-identifier">mkUTF16</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_decode"><span class="hs-identifier">utf16_decode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_encode"><span class="hs-identifier">utf16_encode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be"><span class="hs-identifier">utf16be</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16be"><span class="hs-identifier">mkUTF16be</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier">utf16be_decode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_encode"><span class="hs-identifier">utf16be_encode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le"><span class="hs-identifier">utf16le</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16le"><span class="hs-identifier">mkUTF16le</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier">utf16le_decode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>  </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_encode"><span class="hs-identifier">utf16le_encode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Real.html"><span class="hs-identifier">GHC.Real</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span>
</span><span id="line-44"></span><span class="hs-comment">-- import GHC.IO</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.Buffer.html"><span class="hs-identifier">GHC.IO.Buffer</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html"><span class="hs-identifier">GHC.IO.Encoding.Failure</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html"><span class="hs-identifier">GHC.IO.Encoding.Types</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Word.html"><span class="hs-identifier">GHC.Word</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Bits.html"><span class="hs-identifier">Data.Bits</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IORef.html"><span class="hs-identifier">GHC.IORef</span></a></span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- The UTF-16 codec: either UTF16BE or UTF16LE with a BOM</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16"><span class="hs-identifier hs-type">utf16</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-56"></span><span id="utf16"><span class="annot"><span class="annottext">utf16 :: TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#utf16"><span class="hs-identifier hs-var hs-var">utf16</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16"><span class="hs-identifier hs-var">mkUTF16</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="GHC.IO.Encoding.Failure.html#ErrorOnCodingFailure"><span class="hs-identifier hs-var">ErrorOnCodingFailure</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-comment">-- | @since 4.4.0.0</span><span>
</span><span id="line-59"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16"><span class="hs-identifier hs-type">mkUTF16</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-60"></span><span id="mkUTF16"><span class="annot"><span class="annottext">mkUTF16 :: CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16"><span class="hs-identifier hs-var hs-var">mkUTF16</span></a></span></span><span> </span><span id="local-6989586621679546383"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546383"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">TextEncoding :: forall dstate estate.
String
-&gt; IO (TextDecoder dstate)
-&gt; IO (TextEncoder estate)
-&gt; TextEncoding
</span><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">textEncodingName :: String
</span><a href="GHC.IO.Encoding.Types.html#textEncodingName"><span class="hs-identifier hs-var">textEncodingName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-16&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>                              </span><span class="annot"><span class="annottext">mkTextDecoder :: IO (TextDecoder (Maybe DecodeBuffer))
</span><a href="GHC.IO.Encoding.Types.html#mkTextDecoder"><span class="hs-identifier hs-var">mkTextDecoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextDecoder (Maybe DecodeBuffer))
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_DF"><span class="hs-identifier hs-var">utf16_DF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546383"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-62"></span><span>                              </span><span class="annot"><span class="annottext">mkTextEncoder :: IO (TextEncoder Bool)
</span><a href="GHC.IO.Encoding.Types.html#mkTextEncoder"><span class="hs-identifier hs-var">mkTextEncoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextEncoder Bool)
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_EF"><span class="hs-identifier hs-var">utf16_EF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546383"><span class="hs-identifier hs-var">cfm</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_DF"><span class="hs-identifier hs-type">utf16_DF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextDecoder"><span class="hs-identifier hs-type">TextDecoder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span id="utf16_DF"><span class="annot"><span class="annottext">utf16_DF :: CodingFailureMode -&gt; IO (TextDecoder (Maybe DecodeBuffer))
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_DF"><span class="hs-identifier hs-var hs-var">utf16_DF</span></a></span></span><span> </span><span id="local-6989586621679546376"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546376"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-66"></span><span>  </span><span id="local-6989586621679546375"><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546375"><span class="hs-identifier hs-var">seen_bom</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe DecodeBuffer -&gt; IO (IORef (Maybe DecodeBuffer))
forall a. a -&gt; IO (IORef a)
</span><a href="GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe DecodeBuffer
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-67"></span><span>  </span><span class="annot"><span class="annottext">TextDecoder (Maybe DecodeBuffer)
-&gt; IO (TextDecoder (Maybe DecodeBuffer))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-68"></span><span>             </span><span class="annot"><span class="annottext">encode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_decode"><span class="hs-identifier hs-var">utf16_decode</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546375"><span class="hs-identifier hs-var">seen_bom</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-69"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Failure.html#recoverDecode"><span class="hs-identifier hs-var">recoverDecode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546376"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-70"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-71"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO (Maybe DecodeBuffer)
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; IO (Maybe DecodeBuffer)
forall a. IORef a -&gt; IO a
</span><a href="GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546375"><span class="hs-identifier hs-var">seen_bom</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-72"></span><span>             </span><span class="annot"><span class="annottext">setState :: Maybe DecodeBuffer -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; Maybe DecodeBuffer -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546375"><span class="hs-identifier hs-var">seen_bom</span></a></span><span>
</span><span id="line-73"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_EF"><span class="hs-identifier hs-type">utf16_EF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoder"><span class="hs-identifier hs-type">TextEncoder</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span id="utf16_EF"><span class="annot"><span class="annottext">utf16_EF :: CodingFailureMode -&gt; IO (TextEncoder Bool)
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_EF"><span class="hs-identifier hs-var hs-var">utf16_EF</span></a></span></span><span> </span><span id="local-6989586621679546364"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546364"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-77"></span><span>  </span><span id="local-6989586621679546363"><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546363"><span class="hs-identifier hs-var">done_bom</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO (IORef Bool)
forall a. a -&gt; IO (IORef a)
</span><a href="GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-78"></span><span>  </span><span class="annot"><span class="annottext">TextEncoder Bool -&gt; IO (TextEncoder Bool)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-79"></span><span>             </span><span class="annot"><span class="annottext">encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef Bool -&gt; CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_encode"><span class="hs-identifier hs-var">utf16_encode</span></a></span><span> </span><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546363"><span class="hs-identifier hs-var">done_bom</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-80"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Failure.html#recoverEncode"><span class="hs-identifier hs-var">recoverEncode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546364"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-81"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-82"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO Bool
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef Bool -&gt; IO Bool
forall a. IORef a -&gt; IO a
</span><a href="GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546363"><span class="hs-identifier hs-var">done_bom</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-83"></span><span>             </span><span class="annot"><span class="annottext">setState :: Bool -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IORef Bool -&gt; Bool -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546363"><span class="hs-identifier hs-var">done_bom</span></a></span><span>
</span><span id="line-84"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_encode"><span class="hs-identifier hs-type">utf16_encode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#EncodeBuffer"><span class="hs-identifier hs-type">EncodeBuffer</span></a></span><span>
</span><span id="line-87"></span><span id="utf16_encode"><span class="annot"><span class="annottext">utf16_encode :: IORef Bool -&gt; CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_encode"><span class="hs-identifier hs-var hs-var">utf16_encode</span></a></span></span><span> </span><span id="local-6989586621679546360"><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546360"><span class="hs-identifier hs-var">done_bom</span></a></span></span><span> </span><span id="local-6989586621679546359"><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546359"><span class="hs-identifier hs-var">input</span></a></span></span><span>
</span><span id="line-88"></span><span>  </span><span id="local-6989586621679546358"><span class="annot"><span class="annottext">output :: Buffer Word8
</span><a href="#local-6989586621679546358"><span class="hs-identifier hs-var">output</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546355"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546355"><span class="hs-identifier hs-var">oraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546352"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546352"><span class="hs-identifier hs-var">ow</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546350"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546350"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-89"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-90"></span><span>  </span><span id="local-6989586621679546349"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679546349"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IORef Bool -&gt; IO Bool
forall a. IORef a -&gt; IO a
</span><a href="GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546360"><span class="hs-identifier hs-var">done_bom</span></a></span><span>
</span><span id="line-91"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679546349"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_encode"><span class="hs-identifier hs-var">utf16_native_encode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546359"><span class="hs-identifier hs-var">input</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546358"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-92"></span><span>       </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546350"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546352"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-93"></span><span>               </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(CodingProgress, Buffer Char, Buffer Word8)
-&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546359"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546358"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>               </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-95"></span><span>                    </span><span class="annot"><span class="annottext">IORef Bool -&gt; Bool -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef Bool
</span><a href="#local-6989586621679546360"><span class="hs-identifier hs-var">done_bom</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-96"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546355"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546352"><span class="hs-identifier hs-var">ow</span></a></span><span>     </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bom1"><span class="hs-identifier hs-var">bom1</span></a></span><span>
</span><span id="line-97"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546355"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546352"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bom2"><span class="hs-identifier hs-var">bom2</span></a></span><span>
</span><span id="line-98"></span><span>                    </span><span class="annot"><span class="annottext">CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_encode"><span class="hs-identifier hs-var">utf16_native_encode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546359"><span class="hs-identifier hs-var">input</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546358"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546352"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_decode"><span class="hs-identifier hs-type">utf16_decode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span>
</span><span id="line-101"></span><span id="utf16_decode"><span class="annot"><span class="annottext">utf16_decode :: IORef (Maybe DecodeBuffer) -&gt; DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_decode"><span class="hs-identifier hs-var hs-var">utf16_decode</span></a></span></span><span> </span><span id="local-6989586621679546341"><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546341"><span class="hs-identifier hs-var">seen_bom</span></a></span></span><span>
</span><span id="line-102"></span><span>  </span><span id="local-6989586621679546340"><span class="annot"><span class="annottext">input :: Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span>  </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546339"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546339"><span class="hs-identifier hs-var">iraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546338"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546337"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546337"><span class="hs-identifier hs-var">iw</span></a></span></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-103"></span><span>  </span><span id="local-6989586621679546336"><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span></span><span>
</span><span id="line-104"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-105"></span><span>   </span><span id="local-6989586621679546335"><span class="annot"><span class="annottext">Maybe DecodeBuffer
</span><a href="#local-6989586621679546335"><span class="hs-identifier hs-var">mb</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; IO (Maybe DecodeBuffer)
forall a. IORef a -&gt; IO a
</span><a href="GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546341"><span class="hs-identifier hs-var">seen_bom</span></a></span><span>
</span><span id="line-106"></span><span>   </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe DecodeBuffer
</span><a href="#local-6989586621679546335"><span class="hs-identifier hs-var">mb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-107"></span><span>     </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679546334"><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="#local-6989586621679546334"><span class="hs-identifier hs-var">decode</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="#local-6989586621679546334"><span class="hs-identifier hs-var">decode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-108"></span><span>     </span><span class="annot"><span class="annottext">Maybe DecodeBuffer
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-109"></span><span>       </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546337"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(CodingProgress, Buffer Word8, Buffer Char)
-&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-110"></span><span>       </span><span id="local-6989586621679546332"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546332"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546339"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-111"></span><span>       </span><span id="local-6989586621679546330"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546330"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546339"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>       </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-113"></span><span>        </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546332"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomB"><span class="hs-identifier hs-var">bomB</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546330"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomL"><span class="hs-identifier hs-var">bomL</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-114"></span><span>               </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; Maybe DecodeBuffer -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546341"><span class="hs-identifier hs-var">seen_bom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DecodeBuffer -&gt; Maybe DecodeBuffer
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-var">utf16be_decode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span>               </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-var">utf16be_decode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-116"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546332"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomL"><span class="hs-identifier hs-var">bomL</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546330"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomB"><span class="hs-identifier hs-var">bomB</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-117"></span><span>               </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; Maybe DecodeBuffer -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546341"><span class="hs-identifier hs-var">seen_bom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DecodeBuffer -&gt; Maybe DecodeBuffer
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier hs-var">utf16le_decode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span>               </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier hs-var">utf16le_decode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546338"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-119"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-120"></span><span>               </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer) -&gt; Maybe DecodeBuffer -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef (Maybe DecodeBuffer)
</span><a href="#local-6989586621679546341"><span class="hs-identifier hs-var">seen_bom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DecodeBuffer -&gt; Maybe DecodeBuffer
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_decode"><span class="hs-identifier hs-var">utf16_native_decode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>               </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_decode"><span class="hs-identifier hs-var">utf16_native_decode</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546340"><span class="hs-identifier hs-var">input</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546336"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#bomB"><span class="hs-identifier hs-type">bomB</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#bomL"><span class="hs-identifier hs-type">bomL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#bom1"><span class="hs-identifier hs-type">bom1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#bom2"><span class="hs-identifier hs-type">bom2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-125"></span><span id="bomB"><span class="annot"><span class="annottext">bomB :: Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomB"><span class="hs-identifier hs-var hs-var">bomB</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0xfe</span></span><span>
</span><span id="line-126"></span><span id="bomL"><span class="annot"><span class="annottext">bomL :: Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomL"><span class="hs-identifier hs-var hs-var">bomL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0xff</span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-comment">-- choose UTF-16BE by default for UTF-16 output</span><span>
</span><span id="line-129"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_native_decode"><span class="hs-identifier hs-type">utf16_native_decode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span>
</span><span id="line-130"></span><span id="utf16_native_decode"><span class="annot"><span class="annottext">utf16_native_decode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_decode"><span class="hs-identifier hs-var hs-var">utf16_native_decode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-var">utf16be_decode</span></a></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16_native_encode"><span class="hs-identifier hs-type">utf16_native_encode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#EncodeBuffer"><span class="hs-identifier hs-type">EncodeBuffer</span></a></span><span>
</span><span id="line-133"></span><span id="utf16_native_encode"><span class="annot"><span class="annottext">utf16_native_encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16_native_encode"><span class="hs-identifier hs-var hs-var">utf16_native_encode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_encode"><span class="hs-identifier hs-var">utf16be_encode</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span id="bom1"><span class="annot"><span class="annottext">bom1 :: Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bom1"><span class="hs-identifier hs-var hs-var">bom1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomB"><span class="hs-identifier hs-var">bomB</span></a></span><span>
</span><span id="line-136"></span><span id="bom2"><span class="annot"><span class="annottext">bom2 :: Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bom2"><span class="hs-identifier hs-var hs-var">bom2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="GHC.IO.Encoding.UTF16.html#bomL"><span class="hs-identifier hs-var">bomL</span></a></span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- UTF16LE and UTF16BE</span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be"><span class="hs-identifier hs-type">utf16be</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-142"></span><span id="utf16be"><span class="annot"><span class="annottext">utf16be :: TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be"><span class="hs-identifier hs-var hs-var">utf16be</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16be"><span class="hs-identifier hs-var">mkUTF16be</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="GHC.IO.Encoding.Failure.html#ErrorOnCodingFailure"><span class="hs-identifier hs-var">ErrorOnCodingFailure</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span class="hs-comment">-- | @since 4.4.0.0</span><span>
</span><span id="line-145"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16be"><span class="hs-identifier hs-type">mkUTF16be</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-146"></span><span id="mkUTF16be"><span class="annot"><span class="annottext">mkUTF16be :: CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16be"><span class="hs-identifier hs-var hs-var">mkUTF16be</span></a></span></span><span> </span><span id="local-6989586621679546325"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546325"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TextEncoding :: forall dstate estate.
String
-&gt; IO (TextDecoder dstate)
-&gt; IO (TextEncoder estate)
-&gt; TextEncoding
</span><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">textEncodingName :: String
</span><a href="GHC.IO.Encoding.Types.html#textEncodingName"><span class="hs-identifier hs-var">textEncodingName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-16BE&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-147"></span><span>                               </span><span class="annot"><span class="annottext">mkTextDecoder :: IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.Types.html#mkTextDecoder"><span class="hs-identifier hs-var">mkTextDecoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_DF"><span class="hs-identifier hs-var">utf16be_DF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546325"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-148"></span><span>                               </span><span class="annot"><span class="annottext">mkTextEncoder :: IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.Types.html#mkTextEncoder"><span class="hs-identifier hs-var">mkTextEncoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_EF"><span class="hs-identifier hs-var">utf16be_EF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546325"><span class="hs-identifier hs-var">cfm</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_DF"><span class="hs-identifier hs-type">utf16be_DF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextDecoder"><span class="hs-identifier hs-type">TextDecoder</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span id="utf16be_DF"><span class="annot"><span class="annottext">utf16be_DF :: CodingFailureMode -&gt; IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_DF"><span class="hs-identifier hs-var hs-var">utf16be_DF</span></a></span></span><span> </span><span id="local-6989586621679546322"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546322"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-152"></span><span>  </span><span class="annot"><span class="annottext">TextDecoder () -&gt; IO (TextDecoder ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-153"></span><span>             </span><span class="annot"><span class="annottext">encode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-var">utf16be_decode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-154"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Failure.html#recoverDecode"><span class="hs-identifier hs-var">recoverDecode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546322"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-155"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-156"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-157"></span><span>             </span><span class="annot"><span class="annottext">setState :: () -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; () -&gt; IO ()
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; () -&gt; IO ()) -&gt; IO () -&gt; () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-158"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_EF"><span class="hs-identifier hs-type">utf16be_EF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoder"><span class="hs-identifier hs-type">TextEncoder</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span id="utf16be_EF"><span class="annot"><span class="annottext">utf16be_EF :: CodingFailureMode -&gt; IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_EF"><span class="hs-identifier hs-var hs-var">utf16be_EF</span></a></span></span><span> </span><span id="local-6989586621679546320"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546320"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-162"></span><span>  </span><span class="annot"><span class="annottext">TextEncoder () -&gt; IO (TextEncoder ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-163"></span><span>             </span><span class="annot"><span class="annottext">encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_encode"><span class="hs-identifier hs-var">utf16be_encode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-164"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Failure.html#recoverEncode"><span class="hs-identifier hs-var">recoverEncode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546320"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-165"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-166"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-167"></span><span>             </span><span class="annot"><span class="annottext">setState :: () -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; () -&gt; IO ()
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; () -&gt; IO ()) -&gt; IO () -&gt; () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le"><span class="hs-identifier hs-type">utf16le</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-171"></span><span id="utf16le"><span class="annot"><span class="annottext">utf16le :: TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le"><span class="hs-identifier hs-var hs-var">utf16le</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16le"><span class="hs-identifier hs-var">mkUTF16le</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="GHC.IO.Encoding.Failure.html#ErrorOnCodingFailure"><span class="hs-identifier hs-var">ErrorOnCodingFailure</span></a></span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="hs-comment">-- | @since 4.4.0.0</span><span>
</span><span id="line-174"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#mkUTF16le"><span class="hs-identifier hs-type">mkUTF16le</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span>
</span><span id="line-175"></span><span id="mkUTF16le"><span class="annot"><span class="annottext">mkUTF16le :: CodingFailureMode -&gt; TextEncoding
</span><a href="GHC.IO.Encoding.UTF16.html#mkUTF16le"><span class="hs-identifier hs-var hs-var">mkUTF16le</span></a></span></span><span> </span><span id="local-6989586621679546319"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546319"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TextEncoding :: forall dstate estate.
String
-&gt; IO (TextDecoder dstate)
-&gt; IO (TextEncoder estate)
-&gt; TextEncoding
</span><a href="GHC.IO.Encoding.Types.html#TextEncoding"><span class="hs-identifier hs-type">TextEncoding</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">textEncodingName :: String
</span><a href="GHC.IO.Encoding.Types.html#textEncodingName"><span class="hs-identifier hs-var">textEncodingName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF16-LE&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-176"></span><span>                               </span><span class="annot"><span class="annottext">mkTextDecoder :: IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.Types.html#mkTextDecoder"><span class="hs-identifier hs-var">mkTextDecoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_DF"><span class="hs-identifier hs-var">utf16le_DF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546319"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-177"></span><span>                               </span><span class="annot"><span class="annottext">mkTextEncoder :: IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.Types.html#mkTextEncoder"><span class="hs-identifier hs-var">mkTextEncoder</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode -&gt; IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_EF"><span class="hs-identifier hs-var">utf16le_EF</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546319"><span class="hs-identifier hs-var">cfm</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_DF"><span class="hs-identifier hs-type">utf16le_DF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextDecoder"><span class="hs-identifier hs-type">TextDecoder</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span id="utf16le_DF"><span class="annot"><span class="annottext">utf16le_DF :: CodingFailureMode -&gt; IO (TextDecoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_DF"><span class="hs-identifier hs-var hs-var">utf16le_DF</span></a></span></span><span> </span><span id="local-6989586621679546316"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546316"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-181"></span><span>  </span><span class="annot"><span class="annottext">TextDecoder () -&gt; IO (TextDecoder ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-182"></span><span>             </span><span class="annot"><span class="annottext">encode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier hs-var">utf16le_decode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-183"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Word8 -&gt; Buffer Char -&gt; IO (Buffer Word8, Buffer Char)
</span><a href="GHC.IO.Encoding.Failure.html#recoverDecode"><span class="hs-identifier hs-var">recoverDecode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546316"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-184"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-185"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-186"></span><span>             </span><span class="annot"><span class="annottext">setState :: () -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; () -&gt; IO ()
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; () -&gt; IO ()) -&gt; IO () -&gt; () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_EF"><span class="hs-identifier hs-type">utf16le_EF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Failure.html#CodingFailureMode"><span class="hs-identifier hs-type">CodingFailureMode</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.IO.Encoding.Types.html#TextEncoder"><span class="hs-identifier hs-type">TextEncoder</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span id="utf16le_EF"><span class="annot"><span class="annottext">utf16le_EF :: CodingFailureMode -&gt; IO (TextEncoder ())
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_EF"><span class="hs-identifier hs-var hs-var">utf16le_EF</span></a></span></span><span> </span><span id="local-6989586621679546315"><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546315"><span class="hs-identifier hs-var">cfm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-191"></span><span>  </span><span class="annot"><span class="annottext">TextEncoder () -&gt; IO (TextEncoder ())
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufferCodec :: forall from to state.
CodeBuffer from to
-&gt; (Buffer from -&gt; Buffer to -&gt; IO (Buffer from, Buffer to))
-&gt; IO ()
-&gt; IO state
-&gt; (state -&gt; IO ())
-&gt; BufferCodec from to state
</span><a href="GHC.IO.Encoding.Types.html#BufferCodec"><span class="hs-identifier hs-type">BufferCodec</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-192"></span><span>             </span><span class="annot"><span class="annottext">encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.Types.html#encode"><span class="hs-identifier hs-var">encode</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_encode"><span class="hs-identifier hs-var">utf16le_encode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-193"></span><span>             </span><span class="annot"><span class="annottext">recover :: Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Types.html#recover"><span class="hs-identifier hs-var">recover</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
-&gt; Buffer Char -&gt; Buffer Word8 -&gt; IO (Buffer Char, Buffer Word8)
</span><a href="GHC.IO.Encoding.Failure.html#recoverEncode"><span class="hs-identifier hs-var">recoverEncode</span></a></span><span> </span><span class="annot"><span class="annottext">CodingFailureMode
</span><a href="#local-6989586621679546315"><span class="hs-identifier hs-var">cfm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-194"></span><span>             </span><span class="annot"><span class="annottext">close :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#close"><span class="hs-identifier hs-var">close</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-195"></span><span>             </span><span class="annot"><span class="annottext">getState :: IO ()
</span><a href="GHC.IO.Encoding.Types.html#getState"><span class="hs-identifier hs-var">getState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-196"></span><span>             </span><span class="annot"><span class="annottext">setState :: () -&gt; IO ()
</span><a href="GHC.IO.Encoding.Types.html#setState"><span class="hs-identifier hs-var">setState</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; () -&gt; IO ()
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; () -&gt; IO ()) -&gt; IO () -&gt; () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>          </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-type">utf16be_decode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span>
</span><span id="line-201"></span><span id="utf16be_decode"><span class="annot"><span class="annottext">utf16be_decode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_decode"><span class="hs-identifier hs-var hs-var">utf16be_decode</span></a></span></span><span>
</span><span id="line-202"></span><span>  </span><span id="local-6989586621679546314"><span class="annot"><span class="annottext">input :: Buffer Word8
</span><a href="#local-6989586621679546314"><span class="hs-identifier hs-var">input</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span>  </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546313"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546313"><span class="hs-identifier hs-var">iraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546312"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546312"><span class="hs-identifier hs-var">ir0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546311"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546311"><span class="hs-identifier hs-var">iw</span></a></span></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-203"></span><span>  </span><span id="local-6989586621679546310"><span class="annot"><span class="annottext">output :: Buffer Char
</span><a href="#local-6989586621679546310"><span class="hs-identifier hs-var">output</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546309"><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546309"><span class="hs-identifier hs-var">oraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546308"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546308"><span class="hs-identifier hs-var">ow0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546307"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546307"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-204"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-205"></span><span>       </span><span id="local-6989586621679546274"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546274"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546273"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546272"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span></span><span>
</span><span id="line-206"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546307"><span class="hs-identifier hs-var">os</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-207"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546311"><span class="hs-identifier hs-var">iw</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-208"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546311"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-209"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-210"></span><span>              </span><span id="local-6989586621679546270"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546270"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546313"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-211"></span><span>              </span><span id="local-6989586621679546269"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546269"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546313"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-212"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679546260"><span class="annot"><span class="annottext">x1 :: Word16
</span><a href="#local-6989586621679546260"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546270"><span class="hs-identifier hs-var">c0</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546269"><span class="hs-identifier hs-var">c1</span></a></span><span>
</span><span id="line-213"></span><span>              </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate1"><span class="hs-identifier hs-var">validate1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546260"><span class="hs-identifier hs-var">x1</span></a></span><span>
</span><span id="line-214"></span><span>                 </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679546257"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546257"><span class="hs-identifier hs-var">ow'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; Char -&gt; IO Int
</span><a href="GHC.IO.Buffer.html#writeCharBuf"><span class="hs-identifier hs-var">writeCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546309"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="GHC.Base.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546260"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-215"></span><span>                         </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546274"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546257"><span class="hs-identifier hs-var">ow'</span></a></span><span>
</span><span id="line-216"></span><span>                 </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546311"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-217"></span><span>                      </span><span id="local-6989586621679546254"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546254"><span class="hs-identifier hs-var">c2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546313"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>                      </span><span id="local-6989586621679546253"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546253"><span class="hs-identifier hs-var">c3</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546313"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-219"></span><span>                      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679546246"><span class="annot"><span class="annottext">x2 :: Word16
</span><a href="#local-6989586621679546246"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546254"><span class="hs-identifier hs-var">c2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546253"><span class="hs-identifier hs-var">c3</span></a></span><span>
</span><span id="line-220"></span><span>                      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate2"><span class="hs-identifier hs-var">validate2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546260"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546246"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546243"><span class="hs-identifier hs-var">invalid</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-221"></span><span>                      </span><span id="local-6989586621679546242"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546242"><span class="hs-identifier hs-var">ow'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; Char -&gt; IO Int
</span><a href="GHC.IO.Buffer.html#writeCharBuf"><span class="hs-identifier hs-var">writeCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546309"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="GHC.IO.Encoding.UTF16.html#chr2"><span class="hs-identifier hs-var">chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546260"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546246"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>                      </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546274"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546242"><span class="hs-identifier hs-var">ow'</span></a></span><span>
</span><span id="line-223"></span><span>         </span><span class="hs-keyword">where</span><span>
</span><span id="line-224"></span><span>           </span><span id="local-6989586621679546243"><span class="annot"><span class="annottext">invalid :: IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546243"><span class="hs-identifier hs-var hs-var">invalid</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InvalidSequence"><span class="hs-identifier hs-var">InvalidSequence</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546273"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546272"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span>       </span><span class="hs-comment">-- lambda-lifted, to avoid thunks being built in the inner-loop:</span><span>
</span><span id="line-227"></span><span>       </span><span id="local-6989586621679546271"><span class="annot"><span class="annottext">done :: a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546271"><span class="hs-identifier hs-var hs-var">done</span></a></span></span><span> </span><span id="local-6989586621679546235"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546235"><span class="hs-identifier hs-var">why</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546234"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546234"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546233"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546233"><span class="hs-identifier hs-var">ow</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Buffer Word8, Buffer Char) -&gt; m (a, Buffer Word8, Buffer Char)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546235"><span class="hs-identifier hs-var">why</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-228"></span><span>                                  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546234"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546311"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546314"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-229"></span><span>                                              </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546314"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546234"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-230"></span><span>                                  </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546310"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546233"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-231"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-232"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546274"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546312"><span class="hs-identifier hs-var">ir0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546308"><span class="hs-identifier hs-var">ow0</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier hs-type">utf16le_decode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#DecodeBuffer"><span class="hs-identifier hs-type">DecodeBuffer</span></a></span><span>
</span><span id="line-235"></span><span id="utf16le_decode"><span class="annot"><span class="annottext">utf16le_decode :: DecodeBuffer
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_decode"><span class="hs-identifier hs-var hs-var">utf16le_decode</span></a></span></span><span>
</span><span id="line-236"></span><span>  </span><span id="local-6989586621679546232"><span class="annot"><span class="annottext">input :: Buffer Word8
</span><a href="#local-6989586621679546232"><span class="hs-identifier hs-var">input</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span>  </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546231"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546231"><span class="hs-identifier hs-var">iraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546230"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546230"><span class="hs-identifier hs-var">ir0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546229"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546229"><span class="hs-identifier hs-var">iw</span></a></span></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-237"></span><span>  </span><span id="local-6989586621679546228"><span class="annot"><span class="annottext">output :: Buffer Char
</span><a href="#local-6989586621679546228"><span class="hs-identifier hs-var">output</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546227"><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546227"><span class="hs-identifier hs-var">oraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546226"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546226"><span class="hs-identifier hs-var">ow0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546225"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546225"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-238"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-239"></span><span>       </span><span id="local-6989586621679546194"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546194"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546193"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546192"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span></span><span>
</span><span id="line-240"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546225"><span class="hs-identifier hs-var">os</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-241"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546229"><span class="hs-identifier hs-var">iw</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-242"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546229"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-243"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-244"></span><span>              </span><span id="local-6989586621679546190"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546190"><span class="hs-identifier hs-var">c0</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546231"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-245"></span><span>              </span><span id="local-6989586621679546189"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546189"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546231"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679546182"><span class="annot"><span class="annottext">x1 :: Word16
</span><a href="#local-6989586621679546182"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546189"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546190"><span class="hs-identifier hs-var">c0</span></a></span><span>
</span><span id="line-247"></span><span>              </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate1"><span class="hs-identifier hs-var">validate1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546182"><span class="hs-identifier hs-var">x1</span></a></span><span>
</span><span id="line-248"></span><span>                 </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679546181"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546181"><span class="hs-identifier hs-var">ow'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; Char -&gt; IO Int
</span><a href="GHC.IO.Buffer.html#writeCharBuf"><span class="hs-identifier hs-var">writeCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546227"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Char
</span><a href="GHC.Base.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546182"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span>                         </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546194"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546181"><span class="hs-identifier hs-var">ow'</span></a></span><span>
</span><span id="line-250"></span><span>                 </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546229"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-251"></span><span>                      </span><span id="local-6989586621679546180"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546180"><span class="hs-identifier hs-var">c2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546231"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span>                      </span><span id="local-6989586621679546179"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546179"><span class="hs-identifier hs-var">c3</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; IO Word8
</span><a href="GHC.IO.Buffer.html#readWord8Buf"><span class="hs-identifier hs-var">readWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546231"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-253"></span><span>                      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679546172"><span class="annot"><span class="annottext">x2 :: Word16
</span><a href="#local-6989586621679546172"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546179"><span class="hs-identifier hs-var">c3</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546180"><span class="hs-identifier hs-var">c2</span></a></span><span>
</span><span id="line-254"></span><span>                      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate2"><span class="hs-identifier hs-var">validate2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546182"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546172"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546171"><span class="hs-identifier hs-var">invalid</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-255"></span><span>                      </span><span id="local-6989586621679546170"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546170"><span class="hs-identifier hs-var">ow'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; Char -&gt; IO Int
</span><a href="GHC.IO.Buffer.html#writeCharBuf"><span class="hs-identifier hs-var">writeCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546227"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="GHC.IO.Encoding.UTF16.html#chr2"><span class="hs-identifier hs-var">chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546182"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679546172"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span>                      </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546194"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546170"><span class="hs-identifier hs-var">ow'</span></a></span><span>
</span><span id="line-257"></span><span>         </span><span class="hs-keyword">where</span><span>
</span><span id="line-258"></span><span>           </span><span id="local-6989586621679546171"><span class="annot"><span class="annottext">invalid :: IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546171"><span class="hs-identifier hs-var hs-var">invalid</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InvalidSequence"><span class="hs-identifier hs-var">InvalidSequence</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546193"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546192"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span>       </span><span class="hs-comment">-- lambda-lifted, to avoid thunks being built in the inner-loop:</span><span>
</span><span id="line-261"></span><span>       </span><span id="local-6989586621679546191"><span class="annot"><span class="annottext">done :: a -&gt; Int -&gt; Int -&gt; m (a, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546191"><span class="hs-identifier hs-var hs-var">done</span></a></span></span><span> </span><span id="local-6989586621679546165"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546165"><span class="hs-identifier hs-var">why</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546164"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546164"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546163"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546163"><span class="hs-identifier hs-var">ow</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Buffer Word8, Buffer Char) -&gt; m (a, Buffer Word8, Buffer Char)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546165"><span class="hs-identifier hs-var">why</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-262"></span><span>                                  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546164"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546229"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546232"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-263"></span><span>                                              </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546232"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546164"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-264"></span><span>                                  </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546228"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546163"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-266"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Word8, Buffer Char)
</span><a href="#local-6989586621679546194"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546230"><span class="hs-identifier hs-var">ir0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546226"><span class="hs-identifier hs-var">ow0</span></a></span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16be_encode"><span class="hs-identifier hs-type">utf16be_encode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#EncodeBuffer"><span class="hs-identifier hs-type">EncodeBuffer</span></a></span><span>
</span><span id="line-269"></span><span id="utf16be_encode"><span class="annot"><span class="annottext">utf16be_encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16be_encode"><span class="hs-identifier hs-var hs-var">utf16be_encode</span></a></span></span><span>
</span><span id="line-270"></span><span>  </span><span id="local-6989586621679546162"><span class="annot"><span class="annottext">input :: Buffer Char
</span><a href="#local-6989586621679546162"><span class="hs-identifier hs-var">input</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span>  </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546161"><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546161"><span class="hs-identifier hs-var">iraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546160"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546160"><span class="hs-identifier hs-var">ir0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546159"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546159"><span class="hs-identifier hs-var">iw</span></a></span></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-271"></span><span>  </span><span id="local-6989586621679546158"><span class="annot"><span class="annottext">output :: Buffer Word8
</span><a href="#local-6989586621679546158"><span class="hs-identifier hs-var">output</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546157"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546156"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546156"><span class="hs-identifier hs-var">ow0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546155"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546155"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-272"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-273"></span><span>      </span><span id="local-6989586621679546151"><span class="annot"><span class="annottext">done :: a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546151"><span class="hs-identifier hs-var hs-var">done</span></a></span></span><span> </span><span id="local-6989586621679546150"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546150"><span class="hs-identifier hs-var">why</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546149"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546149"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546148"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546148"><span class="hs-identifier hs-var">ow</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Buffer Char, Buffer Word8) -&gt; m (a, Buffer Char, Buffer Word8)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546150"><span class="hs-identifier hs-var">why</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-274"></span><span>                                 </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546149"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546159"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546162"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-275"></span><span>                                             </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546162"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546149"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-276"></span><span>                                 </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546158"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546148"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>      </span><span id="local-6989586621679546108"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546108"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546107"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546106"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span></span><span>
</span><span id="line-278"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546159"><span class="hs-identifier hs-var">iw</span></a></span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546151"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-279"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546155"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546151"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-280"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-281"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621679546105"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546105"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679546104"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546104"><span class="hs-identifier hs-var">ir'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; IO (Char, Int)
</span><a href="GHC.IO.Buffer.html#readCharBuf"><span class="hs-identifier hs-var">readCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546161"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-282"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546105"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-283"></span><span>             </span><span id="local-6989586621679546101"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546101"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546101"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x10000</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="GHC.IO.Encoding.Failure.html#isSurrogate"><span class="hs-identifier hs-var">isSurrogate</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546105"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546151"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InvalidSequence"><span class="hs-identifier hs-var">InvalidSequence</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-284"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546101"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-285"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546101"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-286"></span><span>                    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546108"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546104"><span class="hs-identifier hs-var">ir'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-287"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-288"></span><span>                    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546155"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546151"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546107"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-289"></span><span>                    </span><span class="hs-keyword">let</span><span>
</span><span id="line-290"></span><span>                         </span><span id="local-6989586621679546096"><span class="annot"><span class="annottext">n1 :: Int
</span><a href="#local-6989586621679546096"><span class="hs-identifier hs-var hs-var">n1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546101"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x10000</span></span><span>
</span><span id="line-291"></span><span>                         </span><span id="local-6989586621679546090"><span class="annot"><span class="annottext">c1 :: Word8
</span><a href="#local-6989586621679546090"><span class="hs-identifier hs-var hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546096"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">18</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0xD8</span></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>                         </span><span id="local-6989586621679546086"><span class="annot"><span class="annottext">c2 :: Word8
</span><a href="#local-6989586621679546086"><span class="hs-identifier hs-var hs-var">c2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546096"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span>                         </span><span id="local-6989586621679546083"><span class="annot"><span class="annottext">n2 :: Int
</span><a href="#local-6989586621679546083"><span class="hs-identifier hs-var hs-var">n2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546096"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x3FF</span></span><span>
</span><span id="line-294"></span><span>                         </span><span id="local-6989586621679546076"><span class="annot"><span class="annottext">c3 :: Word8
</span><a href="#local-6989586621679546076"><span class="hs-identifier hs-var hs-var">c3</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546083"><span class="hs-identifier hs-var">n2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0xDC</span></span><span class="hs-special">)</span><span>
</span><span id="line-295"></span><span>                         </span><span id="local-6989586621679546073"><span class="annot"><span class="annottext">c4 :: Word8
</span><a href="#local-6989586621679546073"><span class="hs-identifier hs-var hs-var">c4</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546083"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-296"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-297"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span>     </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546090"><span class="hs-identifier hs-var">c1</span></a></span><span>
</span><span id="line-298"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546086"><span class="hs-identifier hs-var">c2</span></a></span><span>
</span><span id="line-299"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546076"><span class="hs-identifier hs-var">c3</span></a></span><span>
</span><span id="line-300"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546157"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546073"><span class="hs-identifier hs-var">c4</span></a></span><span>
</span><span id="line-301"></span><span>                    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546108"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546104"><span class="hs-identifier hs-var">ir'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546106"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-303"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546108"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546160"><span class="hs-identifier hs-var">ir0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546156"><span class="hs-identifier hs-var">ow0</span></a></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#utf16le_encode"><span class="hs-identifier hs-type">utf16le_encode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.Types.html#EncodeBuffer"><span class="hs-identifier hs-type">EncodeBuffer</span></a></span><span>
</span><span id="line-306"></span><span id="utf16le_encode"><span class="annot"><span class="annottext">utf16le_encode :: CodeBuffer Char Word8
</span><a href="GHC.IO.Encoding.UTF16.html#utf16le_encode"><span class="hs-identifier hs-var hs-var">utf16le_encode</span></a></span></span><span>
</span><span id="line-307"></span><span>  </span><span id="local-6989586621679546072"><span class="annot"><span class="annottext">input :: Buffer Char
</span><a href="#local-6989586621679546072"><span class="hs-identifier hs-var">input</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span>  </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546071"><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546071"><span class="hs-identifier hs-var">iraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546070"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546070"><span class="hs-identifier hs-var">ir0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546069"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546069"><span class="hs-identifier hs-var">iw</span></a></span></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-308"></span><span>  </span><span id="local-6989586621679546068"><span class="annot"><span class="annottext">output :: Buffer Word8
</span><a href="#local-6989586621679546068"><span class="hs-identifier hs-var">output</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.IO.Buffer.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufRaw :: forall e. Buffer e -&gt; RawBuffer e
</span><a href="GHC.IO.Buffer.html#bufRaw"><span class="hs-identifier hs-var">bufRaw</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546067"><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufL :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">bufR :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546066"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546066"><span class="hs-identifier hs-var">ow0</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufSize :: forall e. Buffer e -&gt; Int
</span><a href="GHC.IO.Buffer.html#bufSize"><span class="hs-identifier hs-var">bufSize</span></a></span><span class="hs-glyph">=</span><span id="local-6989586621679546065"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546065"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-309"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-310"></span><span>      </span><span id="local-6989586621679546061"><span class="annot"><span class="annottext">done :: a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546061"><span class="hs-identifier hs-var hs-var">done</span></a></span></span><span> </span><span id="local-6989586621679546060"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546060"><span class="hs-identifier hs-var">why</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546059"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546059"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546058"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546058"><span class="hs-identifier hs-var">ow</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Buffer Char, Buffer Word8) -&gt; m (a, Buffer Char, Buffer Word8)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679546060"><span class="hs-identifier hs-var">why</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-311"></span><span>                                 </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546059"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546069"><span class="hs-identifier hs-var">iw</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546072"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-312"></span><span>                                             </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Buffer Char
</span><a href="#local-6989586621679546072"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufL :: Int
</span><a href="GHC.IO.Buffer.html#bufL"><span class="hs-identifier hs-var">bufL</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546059"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-313"></span><span>                                 </span><span class="annot"><span class="annottext">Buffer Word8
</span><a href="#local-6989586621679546068"><span class="hs-identifier hs-var">output</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">bufR :: Int
</span><a href="GHC.IO.Buffer.html#bufR"><span class="hs-identifier hs-var">bufR</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546058"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span>      </span><span id="local-6989586621679546020"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546020"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546019"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679546018"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span></span><span>
</span><span id="line-315"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546069"><span class="hs-identifier hs-var">iw</span></a></span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546061"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InputUnderflow"><span class="hs-identifier hs-var">InputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-316"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546065"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546061"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span>
</span><span id="line-317"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-318"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621679546017"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546017"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679546016"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546016"><span class="hs-identifier hs-var">ir'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RawBuffer Char -&gt; Int -&gt; IO (Char, Int)
</span><a href="GHC.IO.Buffer.html#readCharBuf"><span class="hs-identifier hs-var">readCharBuf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Char
</span><a href="#local-6989586621679546071"><span class="hs-identifier hs-var">iraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-319"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="GHC.Base.html#ord"><span class="hs-identifier hs-var">ord</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546017"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-320"></span><span>             </span><span id="local-6989586621679546015"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546015"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546015"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x10000</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="GHC.IO.Encoding.Failure.html#isSurrogate"><span class="hs-identifier hs-var">isSurrogate</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679546017"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546061"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#InvalidSequence"><span class="hs-identifier hs-var">InvalidSequence</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-321"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546015"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546015"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span>                    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546020"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546016"><span class="hs-identifier hs-var">ir'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-324"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-325"></span><span>                    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546065"><span class="hs-identifier hs-var">os</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CodingProgress
-&gt; Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
a -&gt; Int -&gt; Int -&gt; m (a, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546061"><span class="hs-identifier hs-var">done</span></a></span><span> </span><span class="annot"><span class="annottext">CodingProgress
</span><a href="GHC.IO.Encoding.Types.html#OutputUnderflow"><span class="hs-identifier hs-var">OutputUnderflow</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546019"><span class="hs-identifier hs-var">ir</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-326"></span><span>                    </span><span class="hs-keyword">let</span><span>
</span><span id="line-327"></span><span>                         </span><span id="local-6989586621679546012"><span class="annot"><span class="annottext">n1 :: Int
</span><a href="#local-6989586621679546012"><span class="hs-identifier hs-var hs-var">n1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546015"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x10000</span></span><span>
</span><span id="line-328"></span><span>                         </span><span id="local-6989586621679546006"><span class="annot"><span class="annottext">c1 :: Word8
</span><a href="#local-6989586621679546006"><span class="hs-identifier hs-var hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546012"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">18</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0xD8</span></span><span class="hs-special">)</span><span>
</span><span id="line-329"></span><span>                         </span><span id="local-6989586621679546002"><span class="annot"><span class="annottext">c2 :: Word8
</span><a href="#local-6989586621679546002"><span class="hs-identifier hs-var hs-var">c2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546012"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>                         </span><span id="local-6989586621679545999"><span class="annot"><span class="annottext">n2 :: Int
</span><a href="#local-6989586621679545999"><span class="hs-identifier hs-var hs-var">n2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546012"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x3FF</span></span><span>
</span><span id="line-331"></span><span>                         </span><span id="local-6989586621679545993"><span class="annot"><span class="annottext">c3 :: Word8
</span><a href="#local-6989586621679545993"><span class="hs-identifier hs-var hs-var">c3</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679545999"><span class="hs-identifier hs-var">n2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0xDC</span></span><span class="hs-special">)</span><span>
</span><span id="line-332"></span><span>                         </span><span id="local-6989586621679545990"><span class="annot"><span class="annottext">c4 :: Word8
</span><a href="#local-6989586621679545990"><span class="hs-identifier hs-var hs-var">c4</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679545999"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-333"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-334"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span>     </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546002"><span class="hs-identifier hs-var">c2</span></a></span><span>
</span><span id="line-335"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679546006"><span class="hs-identifier hs-var">c1</span></a></span><span>
</span><span id="line-336"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679545990"><span class="hs-identifier hs-var">c4</span></a></span><span>
</span><span id="line-337"></span><span>                    </span><span class="annot"><span class="annottext">RawBuffer Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
</span><a href="GHC.IO.Buffer.html#writeWord8Buf"><span class="hs-identifier hs-var">writeWord8Buf</span></a></span><span> </span><span class="annot"><span class="annottext">RawBuffer Word8
</span><a href="#local-6989586621679546067"><span class="hs-identifier hs-var">oraw</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679545993"><span class="hs-identifier hs-var">c3</span></a></span><span>
</span><span id="line-338"></span><span>                    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546020"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546016"><span class="hs-identifier hs-var">ir'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546018"><span class="hs-identifier hs-var">ow</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-339"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-340"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; IO (CodingProgress, Buffer Char, Buffer Word8)
</span><a href="#local-6989586621679546020"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546070"><span class="hs-identifier hs-var">ir0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679546066"><span class="hs-identifier hs-var">ow0</span></a></span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#chr2"><span class="hs-identifier hs-type">chr2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-343"></span><span id="chr2"><span class="annot"><span class="annottext">chr2 :: Word16 -&gt; Word16 -&gt; Char
</span><a href="GHC.IO.Encoding.UTF16.html#chr2"><span class="hs-identifier hs-var hs-var">chr2</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Word.html#W16%23"><span class="hs-identifier hs-type">W16#</span></a></span><span> </span><span id="local-6989586621679545988"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679545988"><span class="hs-identifier hs-var">a#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Word.html#W16%23"><span class="hs-identifier hs-type">W16#</span></a></span><span> </span><span id="local-6989586621679545987"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679545987"><span class="hs-identifier hs-var">b#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char# -&gt; Char
</span><a href="../../ghc-prim/src/GHC.Types.html#C%23"><span class="hs-identifier hs-var">C#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Char#
</span><a href="../../ghc-prim/src/GHC.Prim.html#chr%23"><span class="hs-identifier hs-var">chr#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679545986"><span class="hs-identifier hs-var">upper#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%2B%23"><span class="hs-operator hs-var">+#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679545985"><span class="hs-identifier hs-var">lower#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%2B%23"><span class="hs-operator hs-var">+#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0x10000#</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-345"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679545984"><span class="annot"><span class="annottext">x# :: Int#
</span><a href="#local-6989586621679545984"><span class="hs-identifier hs-var hs-var">x#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679545988"><span class="hs-identifier hs-var">a#</span></a></span><span>
</span><span id="line-346"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679545983"><span class="annot"><span class="annottext">y# :: Int#
</span><a href="#local-6989586621679545983"><span class="hs-identifier hs-var hs-var">y#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679545987"><span class="hs-identifier hs-var">b#</span></a></span><span>
</span><span id="line-347"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679545986"><span class="annot"><span class="annottext">upper# :: Int#
</span><a href="#local-6989586621679545986"><span class="hs-identifier hs-var hs-var">upper#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-identifier hs-var">uncheckedIShiftL#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679545984"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0xD800#</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">10#</span></span><span>
</span><span id="line-348"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679545985"><span class="annot"><span class="annottext">lower# :: Int#
</span><a href="#local-6989586621679545985"><span class="hs-identifier hs-var hs-var">lower#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679545983"><span class="hs-identifier hs-var">y#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0xDC00#</span></span><span>
</span><span id="line-349"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#chr2"><span class="hs-pragma hs-type">chr2</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#validate1"><span class="hs-identifier hs-type">validate1</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-352"></span><span id="validate1"><span class="annot"><span class="annottext">validate1 :: Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate1"><span class="hs-identifier hs-var hs-var">validate1</span></a></span></span><span> </span><span id="local-6989586621679545982"><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545982"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545982"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545982"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xD800</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545982"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDFFF</span></span><span>
</span><span id="line-353"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#validate1"><span class="hs-pragma hs-type">validate1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#validate2"><span class="hs-identifier hs-type">validate2</span></a></span><span>       </span><span class="hs-glyph">::</span><span>  </span><span class="annot"><a href="GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-356"></span><span id="validate2"><span class="annot"><span class="annottext">validate2 :: Word16 -&gt; Word16 -&gt; Bool
</span><a href="GHC.IO.Encoding.UTF16.html#validate2"><span class="hs-identifier hs-var hs-var">validate2</span></a></span></span><span> </span><span id="local-6989586621679545979"><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545979"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679545978"><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545978"><span class="hs-identifier hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545979"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xD800</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545979"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDBFF</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span>
</span><span id="line-357"></span><span>                  </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545978"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDC00</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679545978"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDFFF</span></span><span>
</span><span id="line-358"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.IO.Encoding.UTF16.html#validate2"><span class="hs-pragma hs-type">validate2</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span></pre></body></html>